
/******************************************************************************\
|    Title:        	 FIGUREF9: Average marginal effect of switcher on lobbying |
|						revenue, alternative treatment coding				   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000


use lobbyist_yearly.dta, clear

** with treatment60 instead of treatment, i.e. incorporating 60 day restrictions
gen switcher2 = 1 if switchtouncovered_treatment60==1 
replace switcher2=0 if treatment60==1

reg log_adjlobrev_wgt i.switcher2##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear log_max_adjannual_pay i.year if posttreat==1, cluster(stafferid)

margins if yearsinceleaving<8, dydx(i.switcher2) over(i.yearsinceleaving)

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) ytitle("Effect estimate for being a switcher") title("Incorporate Days Covered") xtitle("Year since leaving Congress") name(gtreat, replace)


** with Oct-December last year adjustment
gen switcher3 = 1 if switchtouncovered_treatment_dec==1 
replace switcher3=0 if treatment_dec==1

reg log_adjlobrev_wgt i.switcher3##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear log_max_adjannual_pay i.year if posttreat==1, cluster(stafferid)

margins if yearsinceleaving<8, dydx(i.switcher3) over(i.yearsinceleaving)

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) ytitle("Effect estimate for being a switcher") title("Incorporate Last December Covered") xtitle("Year since leaving Congress") name(gtreatment_dec)


graph combine gtreat gtreatment_dec, graphregion(color(white))